<?php namespace Common\Model;
use \Hdphp\Model\Model;
/*
 * 商品属性模型
 * */
class goodsattribute extends Model
{
	protected $table = "goodsattribute";//连接表
	protected $validate = array();
	public function addData()
	{
		if(!$this->create()) return FALSE;
		p($_POST);
		$data=array();//重组数组
		$com_id = Db::table("commodity")->where("com_name",$_POST['com_name'])->pluck("id");
		
		名称重复
		$data['commodity_id'] = $com_id;
		foreach($_POST['att_value'] as $k=>$v){
			foreach($_POST['suid'] as $ks=>$vs)
			$data['att_value'] = $v;
			$data['a_tid'] = $vs;
			$this->add($data);
			//p($data);
		}
		
	}
}
